Conversation
|
Thanks. Released as 2.1.6 |
|
The input validation is still problematic. The original input holds the value of all tags e.g. (tag1,tag2,tag3). If I define a pattern attribute for the input this is now applied to both the whole input and the individual tags. And also if the input type is for example email or url it would cause the whole input to have invalid value if having more than one tag inserted. I think this could be fixed by removing the pattern attribute from the original input and changing its type to text. What do you think? |
|
Makes sense. I'll gladly review any PRs you send my way. Does it matter though? Especially if we never actually trigger validate the original input field? (It might matter, I am just surprised I never bumped into it - probably using it in a different way) BTW: for |
|
It's a problem when using it together with standard HTML forms and HTML validation. Form submit triggers the input validation. Another possible way is to set the type of the original input to 'hidden' in tags-input initialization. That excludes it from the form submit validation. Also the 'required' attribute should not be copied over to the tag insert input because that also makes the form invalid when the tag has been inserted and the tag input field value has been cleared. It depends mostly how you expect to validate the whole tags input value and the individual values of tags. For example when defining the input field validation attributes (required, pattern, maxlength etc.), should they apply to both whole tags value or single values of tags? Currently they are treated as same. Just my thoughts.. |
|
Yup - that's exactly it: it's been a while since I have been using Again: since I am not using |
This pull request fixes the HTML5 input pattern support. Each time a tag is inserted the validity of the base.input is verified. On tags-input init, the base.input is first filled with the value. Without this the base.input validation would be done against an empty value.
Original PR by @thomasdegry
developit#23